const expressSession = require('express-session')

const connectMongo = require('connect-mongo')

module.exports = expressSession({
  name: "$xiexin",
  secret: "qqwweerr12",
  cookie: { maxAge: 1000 * 60 * 60 }, //单位是ms

  // 向服务端发送请求后  是否重置cookie时间
  rolling: true,

  // 是否强制重新保存session
  resave: false,
  // 是否在session还未初始化时就存储 建议true
  saveUninitialized: true,

  store: connectMongo.create({
    mongoUrl: "mongodb://127.0.0.1:27017/cms",
  }),
});
